package com.cmj.controller;

import com.cmj.domain.ResponseResult;
import com.cmj.service.UploadImgServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 头像上传
 */
@RestController
public class UploadController {

    @Autowired
    private UploadImgServer uploadImgServer;

    /**
     * 头像上传控制
     * @param img 头像文件
     * @return 图片链接
     */
    @PostMapping("/upload")
    public ResponseResult uploadImg(MultipartFile img){
        return uploadImgServer.uploadImg(img);
    }
}
